package Mianxiangduixiangzonghelianxi;

public class GirlTest {
    public static void main(String[] args) {
        Gril[] arr = new Gril[4];
        Gril g1 = new Gril("小诗",19,"萌妹子","唱歌");
        Gril g2 = new Gril("小文",29,"御姐","跳舞");
        Gril g3 = new Gril("小铃",22,"萌妹子","看书");
        Gril g4 = new Gril("小丽",18,"萌妹子","唱歌");

        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;
        arr[3] = g4;

        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            Gril girl = arr[i];
            sum = sum + girl.getAge();
        }
        int avg = sum/ arr.length;
        System.out.println(avg);
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            Gril gf = arr[i];
            if(gf.getAge()<avg){
                count++;
                System.out.println(gf.getName()+","+gf.getAge()+","+gf.getGender()+","+gf.getHobby());
            }
        }
        System.out.println(count+"个");
    }
}
